package gui.arp;

import java.awt.Color;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JTable;
import javax.swing.table.TableModel;

@SuppressWarnings("serial")
public class ArpTable extends JTable {
	private ArpCellRenderer cellRenderer;
	private ArpCellEditor cellEditor;
	
	public ArpTable(TableModel model, Color fgColor, Color bgColor, Font font) {
		super(model);
		this.setBackground(bgColor);
		this.setGridColor(fgColor);
		this.setBorder(BorderFactory.createLineBorder(Color.GREEN));
		
		cellRenderer = new ArpCellRenderer(fgColor, font);
		this.setDefaultRenderer(Object.class, cellRenderer);
		
		cellEditor = new ArpCellEditor(Color.RED, font);
		this.setDefaultEditor(Object.class, cellEditor);
		
		this.setCellSelectionEnabled(true);
		
		for (int i = 1; i < 17; i++) {
			this.getColumnModel().getColumn(i).setPreferredWidth(33);
		}
		this.setRowHeight(33);
	}
}
